<!-- HTML header for doxygen 1.8.13-->
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/xhtml;charset=UTF-8"/>
<meta http-equiv="X-UA-Compatible" content="IE=9"/>
<meta name="generator" content="Doxygen 1.8.13"/>
<meta name="viewport" content="width=device-width, initial-scale=1"/>
<title>MTB CAT1 Peripheral driver library: CTB          (Continuous Time Block)</title>
<link href="tabs.css" rel="stylesheet" type="text/css"/>
<script type="text/javascript" src="jquery.js"></script>
<script type="text/javascript" src="dynsections.js"></script>
<link href="navtree.css" rel="stylesheet" type="text/css"/>
<script type="text/javascript" src="resize.js"></script>
<script type="text/javascript" src="navtreedata.js"></script>
<script type="text/javascript" src="navtree.js"></script>
<script type="text/javascript">
  $(document).ready(initResizable);
</script>
<link href="search/search.css" rel="stylesheet" type="text/css"/>
<script type="text/javascript" src="search/searchdata.js"></script>
<script type="text/javascript" src="search/search.js"></script>
<link href="doxygen_style.css" rel="stylesheet" type="text/css" />
</head>
<body>
<div id="top"><!-- do not remove this div, it is closed by doxygen! -->
<div id="titlearea">
<table cellspacing="0" cellpadding="0">
 <tbody>
 <tr style="height: 56px;">
  <td id="projectlogo"><a href="http://www.cypress.com/"><img alt="Logo" src="IFXCYP_one-line.png"/></a></td>
  <td id="projectalign" style="padding-left: 0.5em;">
   <div id="projectname">MTB CAT1 Peripheral driver library</div>
  </td>
 </tr>
 </tbody>
</table>
</div>
<!-- end header part -->
<!-- Generated by Doxygen 1.8.13 -->
<script type="text/javascript">
var searchBox = new SearchBox("searchBox", "search",false,'Search');
</script>
<script type="text/javascript" src="menudata.js"></script>
<script type="text/javascript" src="menu.js"></script>
<script type="text/javascript">
$(function() {
  initMenu('',true,false,'search.php','Search');
  $(document).ready(function() { init_search(); });
});
</script>
<div id="main-nav"></div>
</div><!-- top -->
<div id="side-nav" class="ui-resizable side-nav-resizable">
  <div id="nav-tree">
    <div id="nav-tree-contents">
      <div id="nav-sync" class="sync"></div>
    </div>
  </div>
  <div id="splitbar" style="-moz-user-select:none;" 
       class="ui-resizable-handle">
  </div>
</div>
<script type="text/javascript">
$(document).ready(function(){initNavTree('group__group__ctb.html','');});
</script>
<div id="doc-content">
<!-- window showing the filter options -->
<div id="MSearchSelectWindow"
     onmouseover="return searchBox.OnSearchSelectShow()"
     onmouseout="return searchBox.OnSearchSelectHide()"
     onkeydown="return searchBox.OnSearchSelectKey(event)">
</div>

<!-- iframe showing the search results (closed by default) -->
<div id="MSearchResultsWindow">
<iframe src="javascript:void(0)" frameborder="0" 
        name="MSearchResults" id="MSearchResults">
</iframe>
</div>

<div class="header">
  <div class="summary">
<a href="#groups">API Reference</a>  </div>
  <div class="headertitle">
<div class="title">CTB (Continuous Time Block)</div>  </div>
</div><!--header-->
<div class="contents">
<a name="details" id="details"></a><h2 class="groupheader">General Description</h2>
<p>This driver provides API functions to configure and use the analog CTB. </p>
<p>The functions and other declarations used in this driver are in cy_ctb.h. You can include cy_pdl.h to get access to all functions and declarations in the PDL.</p>
<p>The CTB comprises two identical opamps, a switch routing matrix, and a sample and hold (SH) circuit. The high level features are:</p>
<ul>
<li>Two highly configurable opamps<ul>
<li>Each opamp has programmable power and output drive strength</li>
<li>Each opamp can be configured as a voltage follower using internal routing</li>
<li>Each opamp can be configured as a comparator with optional 10 mV hysteresis</li>
</ul>
</li>
<li>Flexible input and output routing</li>
<li>Works as a buffer or amplifier for SAR ADC inputs</li>
<li>Works as a buffer, amplifier, or sample and hold (SH) for the CTDAC output</li>
<li>Can operate in Deep Sleep power mode</li>
</ul>
<p>Each opamp, marked OA0 and OA1, has one input and three output stages, all of which share the common input stage. Note that only one output stage can be selected at a time. The output stage can operate as a low-drive strength opamp for internal connections (1X), a high-drive strength opamp for driving a device pin (10X), or a comparator.</p>
<p>Using the switching matrix, the opamp inputs and outputs can be connected to dedicated general-purpose I/Os or other internal analog blocks. See the device datasheet for the dedicated CTB port.</p>
<div class="image">
<img src="ctb_block_diagram.png" alt="ctb_block_diagram.png" width="1000px"/>
<div class="caption">
CTB Switch Diagram</div></div>
 <h1><a class="anchor" id="group_ctb_init"></a>
Initialization and Enable</h1>
<p>Before enabling the CTB, set up any external components (such as resistors) that are needed for the design and initialize <a class="el" href="group__group__sysanalog.html">SysAnalog (System Analog Reference Block)</a> by calling <a class="el" href="group__group__sysanalog__functions.html#gacef4e5ae550518abd0004e46e5ec4d64">Cy_SysAnalog_Init</a> and <a class="el" href="group__group__sysanalog__functions.html#ga153249c7b4cea72ee334ae877a211169">Cy_SysAnalog_Enable</a> functions. To configure the entire hardware CTB block, call <a class="el" href="group__group__ctb__functions__init.html#ga11187bf8d766321decd675d3f666adb1">Cy_CTB_Init</a>. The base address of the CTB hardware can be found in the device specific header file. Alternatively, to configure only one opamp without any routing, call <a class="el" href="group__group__ctb__functions__init.html#gafa352730de040364974dc22bd3cec27f">Cy_CTB_OpampInit</a>. The driver also provides a <a class="el" href="group__group__ctb__functions__init.html#ga7bdb789cecd993b6871bc3e31a239473">Cy_CTB_FastInit</a> function for fast and easy initialization of the CTB based on commonly used configurations. They are pre-defined in the driver as:</p>
<p><b> Opamp0 </b></p><ul>
<li><a class="el" href="group__group__ctb__globals.html#ga438621c8e34cc926e7b8272a9e19c32e">Cy_CTB_Fast_Opamp0_Unused</a></li>
<li><a class="el" href="group__group__ctb__globals.html#ga6d35df56bf042d52cb509a429ffd8c66">Cy_CTB_Fast_Opamp0_Comp</a></li>
<li><a class="el" href="group__group__ctb__globals.html#ga4a8e8b6be10950b49f8972996ac93189">Cy_CTB_Fast_Opamp0_Opamp1x</a></li>
<li><a class="el" href="group__group__ctb__globals.html#ga545087984306e4fc93d227aea692811a">Cy_CTB_Fast_Opamp0_Opamp10x</a></li>
<li><a class="el" href="group__group__ctb__globals.html#ga10000ccb349e4cac132219a53f2d946e">Cy_CTB_Fast_Opamp0_Diffamp</a></li>
<li><a class="el" href="group__group__ctb__globals.html#gad9260078469c446c5f6b2e53b8925392">Cy_CTB_Fast_Opamp0_Vdac_Out</a></li>
<li><a class="el" href="group__group__ctb__globals.html#ga0ca19b1b063bd81db94bc7e02edbaa8d">Cy_CTB_Fast_Opamp0_Vdac_Out_SH</a></li>
</ul>
<p><b> Opamp1 </b></p><ul>
<li><a class="el" href="group__group__ctb__globals.html#gae4a5a3ed003aa16c26c9f0a04beacedb">Cy_CTB_Fast_Opamp1_Unused</a></li>
<li><a class="el" href="group__group__ctb__globals.html#gaf52495cb7b5184752af7aa6d3c0bf1cb">Cy_CTB_Fast_Opamp1_Comp</a></li>
<li><a class="el" href="group__group__ctb__globals.html#ga09d24f5970ad021c2dabd7db05041c0e">Cy_CTB_Fast_Opamp1_Opamp1x</a></li>
<li><a class="el" href="group__group__ctb__globals.html#ga86d4fa9e4c70a002c5ac83f9b52b4cb6">Cy_CTB_Fast_Opamp1_Opamp10x</a></li>
<li><a class="el" href="group__group__ctb__globals.html#gaf7800cf7550b08e5dc4ec98f158aeee6">Cy_CTB_Fast_Opamp1_Diffamp</a></li>
<li><a class="el" href="group__group__ctb__globals.html#ga0ef4edc2f1f65ffd267518c2bb241bdd">Cy_CTB_Fast_Opamp1_Vdac_Ref_Aref</a></li>
<li><a class="el" href="group__group__ctb__globals.html#ga97cd507bb9735d4e2adfd77a17706587">Cy_CTB_Fast_Opamp1_Vdac_Ref_Pin5</a></li>
</ul>
<p>After initialization, call <a class="el" href="group__group__ctb__functions__init.html#ga867711bf1d5e8216b7bacdf0975fd712">Cy_CTB_Enable</a> to enable the hardware.</p>
<h1><a class="anchor" id="group_ctb_io_connections"></a>
Input/Output Connections</h1>
<p>The CTB has internal switches to support flexible input and output routing. If these switches have not been configured during initialization, call <a class="el" href="group__group__ctb__functions__switches.html#ga63ec666c26a24b2668124d7ddb69d0d3">Cy_CTB_SetAnalogSwitch</a> to make the input and output connections.</p>
<div class="fragment"><div class="line">    <span class="comment">/* Scenario: OA0 has been configured as an opamp with 10x output drive using the </span></div><div class="line"><span class="comment">     * pre-defined Cy_CTB_Fast_Opamp0_Opamp10x configuration. The 10x output has</span></div><div class="line"><span class="comment">     * a dedicated connection to Pin 9.2.</span></div><div class="line"><span class="comment">     * </span></div><div class="line"><span class="comment">     * Call SetAnalogSwitch to route the non-inverting input of OA0 to Pin 9.0</span></div><div class="line"><span class="comment">     * and the inverting input to Pin 9.1.</span></div><div class="line"><span class="comment">     *</span></div><div class="line"><span class="comment">     * Note that the CTB port may vary based on device. */</span></div><div class="line">    </div><div class="line">    <span class="comment">/* Select OA0 switch register. */</span></div><div class="line">    <a class="code" href="group__group__ctb__enums.html#gaec6e363ff07a3f06e9e4f1c709c1574e">cy_en_ctb_switch_register_sel_t</a> switchSelect = <a class="code" href="group__group__ctb__enums.html#ggaec6e363ff07a3f06e9e4f1c709c1574ea50c28d673af60be66d7e4a4902dbabd3">CY_CTB_SWITCH_OA0_SW</a>;</div><div class="line"></div><div class="line">    <span class="comment">/* Select two switches for Pin 0 and Pin 1 of the CTB port. */</span></div><div class="line">    uint32_t switchMask = <a class="code" href="group__group__ctb__enums.html#gga489ce541855b5cc316c20a7f801b068caf66ad18756866b4ee3f3cd2da7b0fcc0">CY_CTB_SW_OA0_POS_PIN0_MASK</a> | <a class="code" href="group__group__ctb__enums.html#gga489ce541855b5cc316c20a7f801b068ca44bd09da7a365d775cfc1e4dc25b214c">CY_CTB_SW_OA0_NEG_PIN1_MASK</a>;</div><div class="line"></div><div class="line">    <span class="comment">/* Set the state of the switches to closed */</span></div><div class="line">    <a class="code" href="group__group__ctb__enums.html#gac8acf16f6a93889e58b75b4815fe28e1">cy_en_ctb_switch_state_t</a> state = <a class="code" href="group__group__ctb__enums.html#ggac8acf16f6a93889e58b75b4815fe28e1ae2c904113408e3b49060ed262c68b296">CY_CTB_SWITCH_CLOSE</a>;</div><div class="line"></div><div class="line">    <a class="code" href="group__group__ctb__functions__switches.html#ga63ec666c26a24b2668124d7ddb69d0d3">Cy_CTB_SetAnalogSwitch</a>(CTBM0, switchSelect, switchMask, state);</div></div><!-- fragment --><p> As shown in the CTB switch diagram, the 10x output of OA0 and OA1 have dedicated connections to Pin 2 and Pin 3, respectively, of the CTB port. If different output connections are required, the other CTB switches and/or AMUXBUX A/B switches can be used.</p>
<h1><a class="anchor" id="group_ctb_comparator"></a>
Comparator Mode</h1>
<p>Each opamp can be configured as a comparator. Note that when used as a comparator, the hardware shuts down the 1X and 10X output drivers. Specific to the comparator mode, there is an optional 10 mV input hysteresis and configurable edge detection interrupt handling.</p>
<ul>
<li>Negative input terminal: This input is usually connected to the reference voltage.</li>
<li>Positive input terminal: This input is usually connected to the voltage that is being compared.</li>
<li>Comparator digital output: This output goes high when the positive input voltage is greater than the negative input voltage.</li>
</ul>
<p>The comparator output can be routed to a pin or other components using HSIOM or trigger muxes.</p>
<div class="fragment"><div class="line">    <span class="comment">/* Scenario: OA0 and OA1 of the CTB have been configured as comparators.</span></div><div class="line"><span class="comment">     * Route the digital outputs of comparator 0 and 1 to</span></div><div class="line"><span class="comment">     * P9.2 and P9.3, respectively, using HSIOM. */</span></div><div class="line">    <a class="code" href="group__group__gpio__functions__init.html#gaf57c501727276013d3e8974a9fb7d0a7">Cy_GPIO_Pin_FastInit</a>(GPIO_PRT9, 2UL, <a class="code" href="group__group__gpio__drive_modes.html#gacebd8bea6222d742bdfbfd86dabab940">CY_GPIO_DM_STRONG_IN_OFF</a>, 0UL, P9_2_PASS_DSI_CTB_CMP0);</div><div class="line"></div><div class="line">    <a class="code" href="group__group__gpio__functions__init.html#gaf57c501727276013d3e8974a9fb7d0a7">Cy_GPIO_Pin_FastInit</a>(GPIO_PRT9, 3UL, <a class="code" href="group__group__gpio__drive_modes.html#gacebd8bea6222d742bdfbfd86dabab940">CY_GPIO_DM_STRONG_IN_OFF</a>, 0UL, P9_3_PASS_DSI_CTB_CMP1);</div></div><!-- fragment --> <h2><a class="anchor" id="group_ctb_comparator_handling_interrupts"></a>
Handling interrupts</h2>
<p>The comparator output is connected to an edge detector block, which is used to detect the edge (rising, falling, both, or disabled) for interrupt generation.</p>
<p>The following code snippet demonstrates how to implement a routine to handle the interrupt. The routine gets called when any comparator on the device generates an interrupt.</p>
<div class="fragment"><div class="line"></div><div class="line"><span class="comment">/* ISR function to handle the global CTB interrupt. */</span></div><div class="line"><span class="keywordtype">void</span> Comparator_Interrupt(<span class="keywordtype">void</span>)</div><div class="line">{</div><div class="line">    uint32_t intrStatus;</div><div class="line"></div><div class="line">    <span class="comment">/* Get the interrupt status for both comparators of a specific CTB instance on the device. */</span></div><div class="line">    intrStatus = <a class="code" href="group__group__ctb__functions__interrupts.html#gaa05d09b4e77c18c5279aa3353875d85c">Cy_CTB_GetInterruptStatus</a>(CTBM0, <a class="code" href="group__group__ctb__enums.html#gga2175f16ceffc2774b50643be95f32137a4c859afffdcf6dcf16c4350906759488">CY_CTB_OPAMP_BOTH</a>);</div><div class="line"></div><div class="line">    <span class="comment">/* Clear both comparator interrupts so that subsequent interrupts can be handled. */</span></div><div class="line">    <a class="code" href="group__group__ctb__functions__interrupts.html#gad8ad429bd10d7fae38c5a95a77785a60">Cy_CTB_ClearInterrupt</a>(CTBM0, <a class="code" href="group__group__ctb__enums.html#gga2175f16ceffc2774b50643be95f32137a4c859afffdcf6dcf16c4350906759488">CY_CTB_OPAMP_BOTH</a>);</div><div class="line"></div><div class="line">    <span class="keywordflow">if</span> (<a class="code" href="group__group__ctb__enums.html#gga2175f16ceffc2774b50643be95f32137a715789db816ed8db3729da6e57aacdcb">CY_CTB_OPAMP_0</a> == (intrStatus &amp; <a class="code" href="group__group__ctb__enums.html#gga2175f16ceffc2774b50643be95f32137a715789db816ed8db3729da6e57aacdcb">CY_CTB_OPAMP_0</a>))</div><div class="line">    {</div><div class="line">        <span class="comment">/* Do something when comparator 0 interrupt occurs. */</span></div><div class="line">    }</div><div class="line"></div><div class="line">    <span class="keywordflow">if</span> (<a class="code" href="group__group__ctb__enums.html#gga2175f16ceffc2774b50643be95f32137a9318dd62afb23fc0c4dac2abcfcea5f0">CY_CTB_OPAMP_1</a> == (intrStatus &amp; <a class="code" href="group__group__ctb__enums.html#gga2175f16ceffc2774b50643be95f32137a9318dd62afb23fc0c4dac2abcfcea5f0">CY_CTB_OPAMP_1</a>))</div><div class="line">    {</div><div class="line">        <span class="comment">/* Do something when comparator 1 interrupt occurs. */</span></div><div class="line">    }</div><div class="line">}</div></div><!-- fragment --><p> The following code snippet demonstrates how to configure and enable the interrupt.</p>
<div class="fragment"><div class="line">    </div><div class="line">    <span class="comment">/* Scenario: Configure and enable the CTB comparator interrupt. */</span></div><div class="line">                </div><div class="line">    <span class="keyword">const</span> <a class="code" href="structcy__stc__sysint__t.html">cy_stc_sysint_t</a> CTB_IRQ_cfg = {</div><div class="line"><span class="preprocessor">        #if (CY_CPU_CORTEX_M0P)</span></div><div class="line">            <span class="comment">/* .intrSrc         = */</span> NvicMux3_IRQn,             <span class="comment">/* CM0+ interrupt is NVIC #3 */</span></div><div class="line">            <span class="comment">/* .cm0pSrc         = */</span> pass_interrupt_ctbs_IRQn,  <span class="comment">/* Source of NVIC #3 is the global CTB interrupt */</span></div><div class="line">            <span class="comment">/* .intrPriority    = */</span> 7UL                        <span class="comment">/* Interrupt priority is 7 */</span></div><div class="line"><span class="preprocessor">        #else</span></div><div class="line">            <span class="comment">/* .intrSrc         = */</span> pass_interrupt_ctbs_IRQn,  <span class="comment">/* Interrupt source is the global CTB interrupt */</span></div><div class="line">            <span class="comment">/* .intrPriority    = */</span> 7UL                        <span class="comment">/* Interrupt priority is 7 */</span></div><div class="line"><span class="preprocessor">        #endif</span></div><div class="line">    };</div><div class="line"></div><div class="line">    <span class="comment">/* Initialize the interrupt with vector at Comparator_Interrupt(). */</span></div><div class="line">    (void)<a class="code" href="group__group__sysint__functions.html#gab2ff6820a898e9af3f780000054eea5d">Cy_SysInt_Init</a>(&amp;CTB_IRQ_cfg, Comparator_Interrupt);</div><div class="line"></div><div class="line">    <span class="comment">/* Enable the interrupt. */</span></div><div class="line">    NVIC_EnableIRQ(CTB_IRQ_cfg.<a class="code" href="structcy__stc__sysint__t.html#a204a8f07adf056c8d3dd818136da853f">intrSrc</a>);</div></div><!-- fragment --> <h1><a class="anchor" id="group_ctb_opamp_range"></a>
Opamp Input and Output Range</h1>
<p>The input range of the opamp can be rail-to-rail if the charge pump is enabled. Without the charge pump, the input range is 0 V to VDDA - 1.5 V. The output range of the opamp is typically 0.2 V to VDDA - 0.2 V and will depend on the load. See the device datasheet for more detail.</p>
<table class="doxtable">
<tr>
<th>Charge Pump </th><th>Input Range </th><th>Output Range </th></tr>
<tr>
<td>Enabled </td><td>0 V to VDDA </td><td>0.2 V to VDDA - 0.2 V  </td></tr>
<tr>
<td>Disabled </td><td>0 V to VDDA - 1.5 V </td><td>0.2 V to VDDA - 0.2 V  </td></tr>
</table>
<h1><a class="anchor" id="group_ctb_sample_hold"></a>
Sample and Hold Mode</h1>
<p>The CTB has a sample and hold (SH) circuit at the non-inverting input of Opamp0. The circuit includes a hold capacitor, Chold, with a firmware controlled switch, CHD. Sampling and holding the source voltage is performed by closing and opening appropriate switches in the CTB using firmware. If the SH circuit is used for the CTDAC, the <a class="el" href="group__group__ctb__functions__sample__hold.html#ga08a0df606bea1204aa32ea5d343ac650">Cy_CTB_DACSampleAndHold</a> function should be called.</p>
<div class="image">
<img src="ctb_fast_config_vdac_sh.png" alt="ctb_fast_config_vdac_sh.png"/>
</div>
 <h1><a class="anchor" id="group_ctb_dependencies"></a>
Configuration Dependencies</h1>
<p>The CTB relies on other blocks to function properly. The dependencies are documented here.</p>
<h2><a class="anchor" id="group_ctb_dependencies_charge_pump"></a>
Charge Pump Configuration</h2>
<p>Each opamp of the CTB has a charge pump that when enabled increases the input range to the supply rails. When disabled, the opamp input range is 0 - VDDA - 1.5 V. When enabled, the pump requires a clock. Call the <a class="el" href="group__group__ctb__functions__aref.html#gaa9aa3f2c29f0c6ff8cf53c085f3e94a1">Cy_CTB_SetPumpClkSource</a> function in the <a class="el" href="group__group__sysanalog.html">SysAnalog (System Analog Reference Block)</a> driver to set the clock source for all CTBs. This clock can come from one of two sources:</p>
<ol type="1">
<li><p class="startli">A dedicated clock divider from one of the CLK_PATH in the SRSS</p>
<p class="startli">Call the following functions to configure the pump clock from the SRSS:</p><ul>
<li><a class="el" href="group__group__sysclk__clk__pump__funcs.html#ga14876f9c0e98b283defb6883fff0d906">Cy_SysClk_ClkPumpSetSource</a></li>
<li><a class="el" href="group__group__sysclk__clk__pump__funcs.html#ga8d55fc79d235c3918ecb20b953afdb99">Cy_SysClk_ClkPumpSetDivider</a></li>
<li><a class="el" href="group__group__sysclk__clk__pump__funcs.html#ga0249934e0fd1d05a25f7565a8c5b6cde">Cy_SysClk_ClkPumpEnable</a></li>
</ul>
<div class="fragment"><div class="line">    <span class="comment">/* Scenario: Use a 24 Mhz clock from the SRSS for the charge pump clock. */</span></div><div class="line">    </div><div class="line">    <span class="comment">/* Set the source to clock Path 0, which has been configured for 100 MHz FLL. */</span></div><div class="line">    <a class="code" href="group__group__sysclk__clk__pump__funcs.html#ga14876f9c0e98b283defb6883fff0d906">Cy_SysClk_ClkPumpSetSource</a>(<a class="code" href="group__group__sysclk__clk__pump__enums.html#ggab816c6625c6a20701956a4831526cddaa0ddc1f655b605f0939f6ea9635de3378">CY_SYSCLK_PUMP_IN_CLKPATH0</a>);</div><div class="line">    </div><div class="line">    <span class="comment">/* Divide the 100 Mhz by 4. */</span></div><div class="line">    <a class="code" href="group__group__sysclk__clk__pump__funcs.html#ga8d55fc79d235c3918ecb20b953afdb99">Cy_SysClk_ClkPumpSetDivider</a>(<a class="code" href="group__group__sysclk__clk__pump__enums.html#gga8207bb47d9ecd521dc95375c1d46189eaadac3fd4b4235df3814fdf3c8468a273">CY_SYSCLK_PUMP_DIV_4</a>);</div><div class="line">    <a class="code" href="group__group__sysclk__clk__pump__funcs.html#ga0249934e0fd1d05a25f7565a8c5b6cde">Cy_SysClk_ClkPumpEnable</a>();</div><div class="line">    </div><div class="line">    <span class="comment">/* Select the source for the pump clock to be from the SRSS. */</span></div><div class="line">    <a class="code" href="group__group__ctb__functions__aref.html#gaa9aa3f2c29f0c6ff8cf53c085f3e94a1">Cy_CTB_SetPumpClkSource</a>(PASS, <a class="code" href="group__group__ctb__enums.html#ggab17cdf969bc01f75e31685058296f747a328fdf373b541780577a1512901ea537">CY_CTB_CLK_PUMP_SRSS</a>);</div></div><!-- fragment --></li>
<li><p class="startli">One of the Peri Clock dividers</p>
<p class="startli">Call the following functions to configure a Peri Clock divider as the pump clock:</p><ul>
<li><a class="el" href="group__group__sysclk__clk__peripheral__funcs.html#ga2f480c53ecec720ceed823b2692f1698">Cy_SysClk_PeriphAssignDivider</a> with the IP block set to PCLK_PASS_CLOCK_PUMP_PERI</li>
<li><a class="el" href="group__group__sysclk__clk__peripheral__funcs.html#gae7042898b1b6835673182e462be6976e">Cy_SysClk_PeriphSetDivider</a></li>
<li><a class="el" href="group__group__sysclk__clk__peripheral__funcs.html#ga0725e2b222edc601b7d3f56d86d4ff75">Cy_SysClk_PeriphEnableDivider</a></li>
</ul>
<div class="fragment"><div class="line">    <span class="comment">/* Scenario: Use a 25 Mhz clock from the PeriClk dividers for the charge pump clock. */</span></div><div class="line">    uint32_t dividerNum = 1UL;</div><div class="line">    uint32_t dividerValue = 1UL;</div><div class="line">    </div><div class="line">    <span class="comment">/* Use the 8-bit divider type and divider number 1 from the PeriClk, which has been configured for 50 MHz. */</span></div><div class="line">    <a class="code" href="group__group__sysclk__clk__peripheral__funcs.html#ga2f480c53ecec720ceed823b2692f1698">Cy_SysClk_PeriphAssignDivider</a>(PCLK_PASS_CLOCK_PUMP_PERI, <a class="code" href="group__group__sysclk__clk__peripheral__enums.html#gga06138349be16d91fd5d00ded2f4592b8ad2299deae6e36a070de5a60368b319ad">CY_SYSCLK_DIV_8_BIT</a>, dividerNum);</div><div class="line">    </div><div class="line">    <span class="comment">/* Divide the 50 MHz PeriClk by 2 (dividerValue + 1). */</span></div><div class="line">    <a class="code" href="group__group__sysclk__clk__peripheral__funcs.html#gae7042898b1b6835673182e462be6976e">Cy_SysClk_PeriphSetDivider</a>(<a class="code" href="group__group__sysclk__clk__peripheral__enums.html#gga06138349be16d91fd5d00ded2f4592b8ad2299deae6e36a070de5a60368b319ad">CY_SYSCLK_DIV_8_BIT</a>, dividerNum, dividerValue);</div><div class="line">    <a class="code" href="group__group__sysclk__clk__peripheral__funcs.html#ga0725e2b222edc601b7d3f56d86d4ff75">Cy_SysClk_PeriphEnableDivider</a>(<a class="code" href="group__group__sysclk__clk__peripheral__enums.html#gga06138349be16d91fd5d00ded2f4592b8ad2299deae6e36a070de5a60368b319ad">CY_SYSCLK_DIV_8_BIT</a>, dividerNum);</div><div class="line">    </div><div class="line">    <span class="comment">/* Select the source for the pump clock to be from the PeriClk dividers. */</span></div><div class="line">    <a class="code" href="group__group__ctb__functions__aref.html#gaa9aa3f2c29f0c6ff8cf53c085f3e94a1">Cy_CTB_SetPumpClkSource</a>(PASS, <a class="code" href="group__group__ctb__enums.html#ggab17cdf969bc01f75e31685058296f747af379a95545f77d200a58cdadbe9e93fc">CY_CTB_CLK_PUMP_PERI</a>);</div></div><!-- fragment --><p> When the charge pump is enabled, the clock frequency should be set as follows:</p>
</li>
</ol>
<table class="doxtable">
<tr>
<th>Opamp Power Level</th><th>Pump Clock Freq </th></tr>
<tr>
<td>Low or Medium </td><td>8 - 24 MHz  </td></tr>
<tr>
<td>High </td><td>24 MHz  </td></tr>
</table>
<p>The High power level of the opamp requires a 24 MHz pump clock. In Deep Sleep mode, all high frequency clocks are disabled and the charge pump will be disabled.</p>
<dl class="section note"><dt>Note</dt><dd>The same pump clock is used by all opamps on the device. Be aware of this when configuring different opamps to different power levels.</dd></dl>
<h2><a class="anchor" id="group_ctb_dependencies_reference_current"></a>
Reference Current Configurations</h2>
<p>The CTB uses two reference current generators, IPTAT and IZTAT, from the AREF block (see <a class="el" href="group__group__sysanalog.html">SysAnalog (System Analog Reference Block)</a> driver). The IPTAT current is used to trim the slope of the opamp offset across temperature. The AREF must be initialized and enabled for the CTB to function properly.</p>
<p>If the CTB is configured to operate in Deep Sleep mode, the appropriate reference current generators from the AREF block must be enabled in Deep Sleep. When waking up from Deep Sleep, the AREF block has a wakeup time that must be considered. Note that configurations in the AREF block are chip wide and affect all CTBs on the device.</p>
<p>The following reference current configurations are supported:</p>
<table class="doxtable">
<tr>
<th>Reference Current Level</th><th>Supported Mode</th><th>Input Range </th></tr>
<tr>
<td>1 uA </td><td>Active/Low Power </td><td>Rail-to-Rail (charge pump enabled)  </td></tr>
<tr>
<td>1 uA </td><td>Active/Low Power/Deep Sleep </td><td>0 - VDDA-1.5 V (charge pump disabled)  </td></tr>
<tr>
<td>100 nA </td><td>Active/Low Power/Deep Sleep </td><td>0 - VDDA-1.5 V (charge pump disabled)  </td></tr>
</table>
<p>The first configuration provides low offset and drift with maximum input range while consuming the most current. For Deep Sleep operation, use the other two configurations with the charge pump disabled. For ultra low power, use the 100 nA current level. To configure the opamps to operate in one of these options, call <a class="el" href="group__group__ctb__functions__aref.html#ga5a5dfa4b6150d4ba15f05a5c5ccdcaae">Cy_CTB_SetCurrentMode</a>.</p>
<h2><a class="anchor" id="group_ctb_dependencies_sample_hold"></a>
Sample and Hold Switch Control</h2>
<p>If you are using rev-08 of the CY8CKIT-062, the following eight switches in the CTB are enabled by the CTDAC IP block:</p>
<ul>
<li>COS, CA0, CHD, CH6, COB, COR, CRS, and CRD</li>
</ul>
<p>On the rev-08 board, if any of the above switches are used, you must call <a class="el" href="group__group__ctdac__functions__init.html#gaf11183d5debb690a8240f2ee4d304d44">Cy_CTDAC_Enable</a> to enable these switches.</p>
<p>Additionally, on the rev-08 board, if any of the switches are used in Deep Sleep mode, the CTDAC must also be configured to operate in Deep Sleep (see <a class="el" href="group__group__ctdac__functions__basic.html#ga92374004a9bab9201916af6ee54c4f6d">Cy_CTDAC_SetDeepSleepMode</a>).</p>
<p>In later revisions of the board, the switches are enabled by the CTB block so calls to the CTDAC IP block are not necessary.</p>
<h1><a class="anchor" id="group_ctb_more_information"></a>
More Information</h1>
<p>Refer to technical reference manual (TRM) and the device datasheet.</p>
<h1><a class="anchor" id="group_ctb_changelog"></a>
Changelog</h1>
<table class="doxtable">
<tr>
<th>Version</th><th>Changes</th><th>Reason for Change </th></tr>
<tr>
<td rowspan="2">2.20 </td><td>The <a class="el" href="group__group__ctb__functions__aref.html#gaa9aa3f2c29f0c6ff8cf53c085f3e94a1">Cy_CTB_SetPumpClkSource</a> implementation is changed to support the IP header update. </td><td>API workaround.  </td></tr>
<tr>
<td>Fixed power level validation in debug mode. </td><td>Bug Fixing.  </td></tr>
<tr>
<td>2.10 </td><td>Added new power saver modes: <a class="el" href="group__group__ctb__enums.html#gga9cbeea246fe4162a2d4d7be689e807c7a29ea09aec9a63a04cc3d40b9cb482d0d">CY_CTB_POWER_PS_LOW</a>, <a class="el" href="group__group__ctb__enums.html#gga9cbeea246fe4162a2d4d7be689e807c7a8bbc21b1cd8d1b080b682bf3956963d8">CY_CTB_POWER_PS_MEDIUM</a> and <a class="el" href="group__group__ctb__enums.html#gga9cbeea246fe4162a2d4d7be689e807c7adc12104acc34a6485c492507bb915ebd">CY_CTB_POWER_PS_HIGH</a>. </td><td>API enhancement.  </td></tr>
<tr>
<td rowspan="2">2.0 </td><td>Added new function <a class="el" href="group__group__ctb__functions__aref.html#gaa9aa3f2c29f0c6ff8cf53c085f3e94a1">Cy_CTB_SetPumpClkSource</a> with new pump clock source <a class="el" href="group__group__ctb__enums.html#ggab17cdf969bc01f75e31685058296f747a0a18bee7011f49552f490dafe7ff7c14">CY_CTB_CLK_PUMP_DEEPSLEEP</a> for PASS_v2. </td><td>New silicon family support.  </td></tr>
<tr>
<td>The analog routing switches are opening on power down. </td><td>A FW workaround for possible side-effects of the weak pull-ups at OpAmps terminals in PASS_v2.  </td></tr>
<tr>
<td>1.20 </td><td>Fixed the <a class="el" href="group__group__ctb__functions__init.html#gafa352730de040364974dc22bd3cec27f">Cy_CTB_OpampInit</a> function to do not affect another OpAmp instance. </td><td>Bug fixing.  </td></tr>
<tr>
<td>1.10.3 </td><td>Minor documentation updates. </td><td>Documentation enhancement.  </td></tr>
<tr>
<td>1.10.2 </td><td>The <a class="el" href="group__group__ctb__functions__init.html#ga11187bf8d766321decd675d3f666adb1">Cy_CTB_Init</a> function description is expanded with a clarification note. </td><td>Documentation enhancement based on a usability feedback.  </td></tr>
<tr>
<td>1.10.1 </td><td>Added header guard CY_IP_MXS40PASS to the source file. </td><td>To enable the PDL compilation with wounded out IP blocks.  </td></tr>
<tr>
<td rowspan="2">1.10 </td><td>Flattened the organization of the driver source code into the single source directory and the single include directory.  </td><td>Driver library directory-structure simplification.   </td></tr>
<tr>
<td>Added register access layer. Use register access macros instead of direct register access using dereferenced pointers. </td><td>Makes register access device-independent, so that the PDL does not need to be recompiled for each supported part number.  </td></tr>
<tr>
<td>1.0 </td><td>Initial version </td><td></td></tr>
</table>
<table class="memberdecls">
<tr class="heading"><td colspan="2"><h2 class="groupheader"><a name="groups"></a>
API Reference</h2></td></tr>
<tr class="memitem:group__group__ctb__macros"><td class="memItemLeft" align="right" valign="top">&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="group__group__ctb__macros.html">Macros</a></td></tr>
<tr class="separator:"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:group__group__ctb__functions"><td class="memItemLeft" align="right" valign="top">&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="group__group__ctb__functions.html">Functions</a></td></tr>
<tr class="separator:"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:group__group__ctb__globals"><td class="memItemLeft" align="right" valign="top">&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="group__group__ctb__globals.html">Global Variables</a></td></tr>
<tr class="separator:"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:group__group__ctb__data__structures"><td class="memItemLeft" align="right" valign="top">&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="group__group__ctb__data__structures.html">Data Structures</a></td></tr>
<tr class="separator:"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:group__group__ctb__enums"><td class="memItemLeft" align="right" valign="top">&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="group__group__ctb__enums.html">Enumerated Types</a></td></tr>
<tr class="separator:"><td class="memSeparator" colspan="2">&#160;</td></tr>
</table>
</div><!-- contents -->
</div><!-- doc-content -->
<!-- start footer part
<div id="nav-path" class="navpath">
    <ul>
        <li class="footer">
            Generated for <b>MTB CAT1 Peripheral driver library</b> by <b>Cypress Semiconductor Corporation</b>.
            All rights reserved.
        </li>
    </ul>
</div>
-->
</body>
</html>
